import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    theme: ThemeData(
      // 这里就是参数
      brightness: Brightness.dark,
      primaryColor: Colors.amber,
      canvasColor: const Color.fromRGBO(255, 255, 255, 1),
      cardColor: Colors.amber,
    ),
    home: Scaffold(
        appBar: AppBar(
          title: const Text("第一个flutter界面"),
        ),
        body: const HomeWidget2()),
  ));
}

class HomeWidget extends StatelessWidget {
  const HomeWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        alignment: Alignment.center,
        height: 200,
        width: 200,
        //背景
        // color: Colors.red,
        //渐变
        decoration: const BoxDecoration(
            color: Colors.yellow,
            gradient: LinearGradient(
              //LinearGradient 背景线性渐变   RadialGradient径向渐变
              colors: [Colors.red, Colors.orange],
            ),
            boxShadow: [
              //卡片阴影
              BoxShadow(
                color: Colors.blue,//颜色
                offset: Offset(2.0, 2.0),//偏移值
                blurRadius: 20.0,//阴影长度
              )
            ],
            border: Border(
              top: BorderSide(
                width: 1,
                color: Colors.red
              )
            )
        ),
        child: const Text(
          "你好Flutter",
          style: TextStyle(fontSize: 20),
        ),
      ),
    );
  }
}



class HomeWidget2 extends StatelessWidget {
  const HomeWidget2({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        alignment: Alignment.center,
        height: 40,
        width: 200,
        decoration: BoxDecoration(
          color: Colors.red,
          borderRadius: BorderRadius.circular(15)
        ),
        child: const Text(
          "你好Flutter",
          style: TextStyle(fontSize: 20),
        ),
      ),
    );
  }
}